package com.yh.threadTest.pojo;

/**
 * @ClassName TestJoin
 * @Description TODO
 * @Author 0715-YuHao
 * @Date 2020/11/14 13:04
 */
public class TestJoin implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println("我插队了" + i);
        }
    }

    public static void main(String[] args) {
        Runnable r = new TestJoin();
        Thread t = new Thread(r);
        t.start();
        for (int i = 0; i < 1000; i++) {
            if (i == 5) {
                try {
                    t.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("我在排队" + i);
        }
    }
}
